<?php
/**
 * created by zzy
 * date: 2018/1/26 14:04
 */
namespace App\Eloquent\Ygt;

class SaleCompanyRelation extends DbEloquent{

    protected $table    = 'ygt_sale_company_relation';
    public static $tableFieldList   = [
        ['name'=>'id','title'=>'','value'=>0,'is_must'=>0],
        ['name'=>'user_id','title'=>'登录用户异常','value'=>0,'is_must'=>1],
        ['name'=>'sale_company_id','title'=>'买家所属厂','value'=>0,'is_must'=>1],
    ];

    public static function edit($data,$pk='')
    {
        $id                 = isset($data['id']) ? intval($data['id']) : 0;
        if($id>0){
            $where          = ['id'=>$id];
            $result         = self::updateOneData($where, $data,$pk);
        } else {
            $result         = self::insertOneData($data,$pk);
        }
        return $result;
    }

}

